from fastapi import FastAPI
import uvicorn
from fastapi.staticfiles import StaticFiles
from tortoise.contrib.fastapi import register_tortoise
from settings import TORTOISE_ORM
from apps.bilibili.urls import bilibili
from apps.users.urls import users

app = FastAPI(debug=True)  # 生产环境debug记得关

app.mount("/statics", StaticFiles(directory="statics"))

register_tortoise(
    app,
    config=TORTOISE_ORM
)

app.include_router(bilibili, prefix="/bilibili", tags=["Bilibili_APi"])
app.include_router(users, prefix="/users", tags=["Users_APi"])

if __name__ == '__main__':
    uvicorn.run("main:app", port=8080, reload=True)
